<?php

namespace PhpYes\Modules\Log;


final class LogHelper
{
    private static $defaultLogger = null;

    public static function log($level, $message)
    {
        if (empty(self::$defaultLogger)) {
            self::$defaultLogger = LoggerManager::getSingleObj()->getLogger();
        }
        if (empty(self::$defaultLogger)) {
            return;
        }

        self::$defaultLogger->log($level, $message);
    }

    public static function emergency($message)
    {
        self::log(LogLevel::EMERGENCY, $message);
    }

    public static function alert($message)
    {
        self::log(LogLevel::ALERT, $message);
    }

    public static function critical($message)
    {
        self::log(LogLevel::CRITICAL, $message);
    }

    public static function error($message)
    {
        self::log(LogLevel::ERROR, $message);
    }

    public static function warning($message)
    {
        self::log(LogLevel::WARNING, $message);
    }

    public static function notice($message)
    {
        self::log(LogLevel::NOTICE, $message);
    }

    public static function info($message)
    {
        self::log(LogLevel::INFO, $message);
    }

    public static function debug($message)
    {
        self::log(LogLevel::DEBUG, $message);
    }

}